﻿using Microsoft.Extensions.DependencyInjection;
using PHMEE.EnergyEfficiency;
using PHMEE.IRepositories.Diagnosis;
using Volo.Abp.Modularity;

namespace PHMEE.TDengineInfrastructure
{
    [DependsOn(typeof(PHMEEDomainModule))]
    public class PHMEETDengineInfrastructureModule: AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            context.Services.Configure<TDengineOptions>(context.Services.GetConfiguration().GetSection("TDengine"));

            context.Services.AddSingleton<ITDConnectionFactory, TDConnectionFactory>();

            context.Services.AddScoped<IWaveDataAlarmTDRepository, WaveDataAlarmTDRepository>();

            //context.Services.AddScoped(typeof(IEEModelRepository<>), typeof(EEModelRepository<>));
            //context.Services.AddScoped(typeof(IFuelConsumptionEEModelRepository<>), typeof(FuelConsumptionEEModelRepository<>));

            #region TDengine Repositories 注册

            #nullable enable

            context.Services.AddScoped<IGpsTdRepository, GpsTdRepository>();
            context.Services.AddScoped<ILogAbstractRepository, LogAbstractRepository>();
            context.Services.AddScoped<IBunkerReportRepository, BunkerReportRepository>();
            context.Services.AddScoped<IFlowMeterTdRepository, FlowMeterTdRepository>();
            context.Services.AddScoped<IAnalogTDRepository, AnalogTDRepository>();
            context.Services.AddScoped<IDigitalTDRepository, DigitalTDRepository>();
            context.Services.AddScoped<IShaftPowerMeterTdRepository, ShaftPowerMeterTdRepository>();

            context.Services.AddScoped<IMassFlowMeterRepository, MassFlowMeterRepository>();
            #nullable disable

            #endregion
        }
    }
}
